
#ifndef M3D_MATH_H
#define M3D_MATH_H

#include <math.h>
#include "m3d.h"

/*
#ifdef __cplusplus
extern "C" {
#endif
*/

M3D_BEGIN_NAMESPACE

#ifndef MAX
#define MAX(x, y)           (((x) > (y))?(x):(y))
#endif

#ifndef MIN
#define MIN(x, y)           (((x) < (y))?(x):(y))
#endif

#ifndef ABS
#define ABS(x)              (((x)<0) ? -(x) : (x))
#endif



inline mdouble mSqrt(mdouble v)
{
	return sqrt(v);

}

inline mdouble mSin(mdouble v)
{
	return sin(v);
}

inline mdouble mCos(mdouble v)
{
	return cos(v);
}

inline mdouble mAsin(mdouble v)
{
	return asin(v);
}




inline bool mFuzzyIsNull(mdouble d)
{
    return ABS(d) <= 0.000000000001;
}
/*
static inline bool mFuzzyIsNull(float f)
{
    return ABS(f) <= 0.00001f;
}
*/

/*
#ifdef __cplusplus
}
#endif
*/

M3D_END_NAMESPACE

#endif
